const express = require('express');
const app = express()
const menus = require('../mockData/menuData');

app.post('/common/doLogin', (req, res) => {
    // 接收接口请求参数
    let requestPayload = req.body
    console.log("正在进行登录账号", requestPayload)

    // res.set('Content-Type', 'application/json')
    // 设置 Cookie
    res.cookie('satoken', 'zhe shi yi ge xiaoli tongxue de cookie token', {
        maxAge: 24 * 60 * 60 * 1000, // 24小时
        httpOnly: true
    });
    res.send({
        code: 200,
        success: true,
        msg: "操作成功",
        data: {
            name: "小李同学",
            account: "小李同学",
            password: "******",
            token: "123asd123asd123ads",
            menus: menus
        },
    })
})
app.post('/common/captcha/getCaptcha', (req, res) => {
    // 模拟参数
    // req.body.content = { type: "line" }
    // 接收接口请求参数
    let requestPayload = req.body
    console.log("获取短信验证码接口请求参数", requestPayload)

    res.send({
        "msg": "操作成功",
        "code": 200,
        "data": {
            "imageBase64": "",
            "captchaType": "line",
            "captchaId": "Afe3KX7B8FndJC_v0j5uKYbGODVRIQURX8SD4hBiGlc1472YDfZ-cxiZnLbPCUEc"
        },
        "success": true
    })
})
module.exports = app;
